//
//  ButtonPage.swift
//  SwiftUIDemo
//
//  Created by zhouzuosong on 2020/8/18.
//  Copyright © 2020 Kael. All rights reserved.
//

import SwiftUI

struct ButtonPage: View {
    var body: some View {
        ScrollView(.vertical, showsIndicators: /*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/, content: {
            ZStack {
                Color.gray
                VStack (alignment: .center, spacing: 20){
                    Spacer()
                    Text("Button").font(.title)
                    
                    HStack(spacing: 20) {
                        Button("默认样式"){
                            
                        }
                        Spacer()
                        Button(action: {}, label: {
                            Text("Button").foregroundColor(.red)
                            
                        })
                        .padding()
                        .background(Color.yellow)
                        .foregroundColor(.gray)
                        .cornerRadius(8.0)
                        
                        Spacer()
                        
                        Button(action: {}, label: {
                            VStack {
                                Text("新用户？")
                                Text("点我注册")
                            }
                            .padding()
                            .background(Color.pink)
                            .foregroundColor(.white)
                            .cornerRadius(8)
                        })
                    }
    //                .frame(minWidth: .infinity)
                    .padding()
                    .background(Color.green)
                    
                    HStack(spacing: 20) {
                        Button(action: {}, label: {
                            Text("Button")
                                .foregroundColor(.white)
                                .padding()
                                .background(Color.purple)
                                .cornerRadius(8.0)
                            
                        })
                        
                        
                        Spacer()
                        
                        Button(action: {}, label: {
                            Text("Button")
                                .foregroundColor(.white)
                                .padding()
                                .background(Color.purple)
                                .cornerRadius(8)
                        })
                        .shadow(color: .purple, radius: 20, x: 0.0, y: 3.0)
                        
                        Spacer()
                        
                        Button(action: {}, label: {
                            Text("Button")
                                .foregroundColor(.white)
                                .padding()
                                .background(Color.purple)
                                .cornerRadius(100)// 设置足够大
                        })
                        
                    }
                    .padding()
                    .background(Color.white)
                    
                    
                    HStack(spacing: 20) {
                        Button(action: {}, label: {
                            Text("Button")
                                .padding(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10))
                                .border(Color.gray)
                                .foregroundColor(.gray)
                        })
                        
                        
                        Spacer()
                        
                        Button(action: {}, label: {
                            Text("Button")
                                .padding(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10))
                                .border(Color.gray)
                                .foregroundColor(.gray)
                                .cornerRadius(8)
                        })
                        
                        Spacer()
                        
                        Button(action: {}, label: {
                            Text("Button")
                                .padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
                                .foregroundColor(.gray)
                                .background(RoundedRectangle(cornerRadius: 10).stroke(Color.gray, lineWidth: 2))
                        })
                        
                    }
                    .padding()
                    .background(Color.white)
                    
                    HStack(spacing: 20) {
                        Button(action: {}, label: {
                            Text("礼物")
    //                            .padding(.horizontal)
                            Image(systemName: "gift.fill")
                        })
                        .padding()
                        .foregroundColor(.white)
                        .background(Color.purple)
                        .cornerRadius(8)
                        .layoutPriority(1)
                        
                        Spacer()
                        
                        Button(action: {}, label: {
                            Image(systemName: "gift.fill")
                            Text("礼物")
    //                            .padding(.horizontal)
                        })
                        .padding()
                        .foregroundColor(.white)
                        .background(Color.purple)
                        .cornerRadius(8)
                        .layoutPriority(1)
                        
                        Spacer()

                        Button(action: {}, label: {
                            VStack {
                                Text("礼物")
                                    .padding(.vertical)
                                Image(systemName: "gift.fill")

                            }
                        })
                        .padding()
                        .foregroundColor(.white)
                        .background(Color.purple)
                        .cornerRadius(8)
                        .layoutPriority(1)
                        
                    }
                    .padding()
                    .background(Color.white)
                    
                    HStack(spacing: 20) {
                        Button(action: {}, label: {
                            Image("boy")
                        })
                        
                        Button(action: {}, label: {
                            Image("boy")
                                .renderingMode(.original)
                        })
                        
                    }
                    .padding()
                    .frame(maxWidth: .infinity)
                    .background(Color.white)
                    VStack{
                        HStack {
                            Spacer()
                            Button(action: {}, label: {
                                Image(systemName: "plus")
                                    .font(.title)
                            })
                            .padding()
                            .foregroundColor(.white)
                            .background(Color.purple)
                            .cornerRadius(100)
                        }
                        
                    }
                    .padding(.trailing, 30)
                    
                }
            }
            
        })
        .edgesIgnoringSafeArea(.all)
        
    }
}

struct ButtonPage_Previews: PreviewProvider {
    static var previews: some View {
        ButtonPage()
    }
}
